package com.study.aop.Util;

import com.study.aop.entity.common.ResponseEntity;
import com.study.aop.enums.ResponseEnum;
import org.springframework.stereotype.Component;

/**
 * @author flwu
 * @date 2020/3/19 3:15 PM
 * @MOTTO 保持空杯和敬畏
 */
public class ResponseUtil<T> {

    public static <T> ResponseEntity success(T data) {
        return new ResponseEntity(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getDesc(), data);
    }

    public static ResponseEntity success() {
        return new ResponseEntity(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getDesc());
    }

    public static ResponseEntity fail(String message) {
        return new ResponseEntity(ResponseEnum.FAIL.getCode(), ResponseEnum.FAIL.getDesc());
    }

    public static ResponseEntity other(String message) {
        return new ResponseEntity(ResponseEnum.OTHER.getCode(), ResponseEnum.OTHER.getDesc());
    }
}
